package com.wnhz.work.yz.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bigkoo.pickerview.OptionsPickerView;
import com.google.gson.Gson;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.wnhz.work.yz.BaseActivity;
import com.wnhz.work.yz.MyApplication;
import com.wnhz.work.yz.R;
import com.wnhz.work.yz.base.BaseRVAdapter;
import com.wnhz.work.yz.base.BaseViewHolder;
import com.wnhz.work.yz.bean.Details0Bean;
import com.wnhz.work.yz.bean.Details0Bean2;
import com.wnhz.work.yz.bean.Finish1;
import com.wnhz.work.yz.bean.JsonBean;
import com.wnhz.work.yz.utils.GetJsonDataUtil;
import com.wnhz.work.yz.utils.GlideImageLoader;
import com.wnhz.work.yz.utils.Url;
import com.wnhz.work.yz.utils.xutils3.MyCallBack;
import com.wnhz.work.yz.utils.xutils3.XUtil;
import com.youth.banner.Banner;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.json.JSONException;
import org.json.JSONObject;

import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class InstallDetails0Activity extends BaseActivity implements View.OnClickListener {
//    private LinearLayout cailiao, zhuangxiu;
//    private View zhuangxiuxian;
//    private RecyclerView youxiu;

    private Banner banner;
    private TextView title, info, price, area, comnum, look, project_name,
            your_name, your_address, your_phone, your_area, pingjia;
    private RecyclerView commit;

    private void setData(final Details0Bean2.InfoEntity info) {
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        banner.setImages(info.getIndex_pic());
        //banner设置方法全部调用完毕时最后调用
        banner.start();
        //
        title.setText("" + info.getName());
        this.info.setText("" + info.getDes());
        price.setText("¥" + info.getPrice() + "/" + info.getUnit());
        pingjia.setText("用户评价：(" + info.getComment_nums() + ")");
        comnum.setText("" + info.getComment_nums());
        commit.setAdapter(new BaseRVAdapter(this, info.getComment()) {
            @Override
            public int getLayoutId(int viewType) {
                return R.layout.item_comment2;
            }

            @Override
            public void onBind(BaseViewHolder holder, int position) {
                ImageLoader.getInstance().displayImage(info.getComment().get(position).getHead_img(), holder.getImageView(R.id.head));
                holder.setTextView(R.id.name, info.getComment().get(position).getRealname());
                holder.setTextView(R.id.time, info.getComment().get(position).getAdd_time());
                holder.setTextView(R.id.info, info.getComment().get(position).getContent());


                final List<String> img = info.getComment().get(position).getImg();
                LinearLayout status1 = holder.getView(R.id.status1);
                LinearLayout status2 = holder.getView(R.id.status2);
                LinearLayout status3 = holder.getView(R.id.status3);
                ImageView img1 = holder.getImageView(R.id.img1);
                ImageView img2_1 = holder.getImageView(R.id.img2_1);
                ImageView img2_2 = holder.getImageView(R.id.img2_2);
                RecyclerView img_recycler = holder.getView(R.id.img_recycler);
                switch (img.size()) {
                    case 0:
                        status1.setVisibility(View.GONE);
                        status2.setVisibility(View.GONE);
                        status3.setVisibility(View.GONE);


                        break;
                    case 1:
                        status1.setVisibility(View.VISIBLE);
                        status2.setVisibility(View.GONE);
                        status3.setVisibility(View.GONE);
                        com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(img.get(0),
                                img1);
                        img1.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                Intent intent = new Intent(InstallDetails0Activity.this, ShowImageDetail.class);
                                intent.putStringArrayListExtra("paths", (ArrayList<String>) img);
                                intent.putExtra("index", 0);
                                startActivity(intent);
                            }
                        });
                        break;
                    case 2:
                        status1.setVisibility(View.GONE);
                        status2.setVisibility(View.VISIBLE);
                        status3.setVisibility(View.GONE);
                        com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(img.get(0),
                                img2_1);
                        com.nostra13.universalimageloader.core.ImageLoader.getInstance().displayImage(img.get(1),
                                img2_2);
                        img2_1.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                Intent intent = new Intent(InstallDetails0Activity.this, ShowImageDetail.class);
                                intent.putStringArrayListExtra("paths", (ArrayList<String>) img);
                                intent.putExtra("index", 0);
                                startActivity(intent);
                            }
                        });
                        img2_2.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                Intent intent = new Intent(InstallDetails0Activity.this, ShowImageDetail.class);
                                intent.putStringArrayListExtra("paths", (ArrayList<String>) img);
                                intent.putExtra("index", 1);
                                startActivity(intent);
                            }
                        });
                        break;
                    default:
                        status1.setVisibility(View.GONE);
                        status2.setVisibility(View.GONE);
                        status3.setVisibility(View.VISIBLE);
                        img_recycler.setLayoutManager(new GridLayoutManager(InstallDetails0Activity.this, 3, LinearLayoutManager.VERTICAL, false));
                        img_recycler.setAdapter(new BaseRVAdapter(InstallDetails0Activity.this, img) {
                            @Override
                            public int getLayoutId(int viewType) {
                                return R.layout.item_photo;
                            }

                            @Override
                            public void onBind(BaseViewHolder holder, final int position) {
                                holder.getImageView(R.id.img).setOnClickListener(new View.OnClickListener() {
                                    @Override
                                    public void onClick(View v) {
                                        Intent intent = new Intent(InstallDetails0Activity.this, ShowImageDetail.class);
                                        intent.putStringArrayListExtra("paths", (ArrayList<String>) img);
                                        intent.putExtra("index", position);
                                        startActivity(intent);
                                    }
                                });
                                ImageLoader.getInstance().displayImage(img.get(position), holder.getImageView(R.id.img));
                            }

                        });

                        break;
                }

            }

        });

    }

    private void initView() {
        commit = (RecyclerView) findViewById(R.id.commit);
        commit.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
        findViewById(R.id.select_project).setOnClickListener(this);
        findViewById(R.id.address).setOnClickListener(this);
        findViewById(R.id.look).setOnClickListener(this);
        findViewById(R.id.look2).setOnClickListener(this);
        findViewById(R.id.btn).setOnClickListener(this);
        pingjia = (TextView) findViewById(R.id.pingjia);
        banner = (Banner) findViewById(R.id.banner);
        title = (TextView) findViewById(R.id.title);
        info = (TextView) findViewById(R.id.info);
        area = (TextView) findViewById(R.id.area);
        comnum = (TextView) findViewById(R.id.comnum);
        look = (TextView) findViewById(R.id.look);
        price = (TextView) findViewById(R.id.price);
        project_name = (TextView) findViewById(R.id.project_name);
        //
        your_name = (TextView) findViewById(R.id.your_name);
        your_address = (TextView) findViewById(R.id.your_address);
        your_area = (TextView) findViewById(R.id.your_area);
        your_phone = (TextView) findViewById(R.id.your_phone);
        if (!"1".equals(pid)) {
            findViewById(R.id.select).setVisibility(View.VISIBLE);
            findViewById(R.id.info999).setVisibility(View.GONE);
            findViewById(R.id.btn).setVisibility(View.GONE);
        } else {
            findViewById(R.id.select).setVisibility(View.GONE);
            findViewById(R.id.info999).setVisibility(View.VISIBLE);
            findViewById(R.id.btn).setVisibility(View.VISIBLE);
        }
    }


    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onEventMainThread(Finish1 event) {
        finish();
    }


    @Override
    protected void onDestroy() {
        EventBus.getDefault().unregister(this);//反注册EventBus
        super.onDestroy();
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_install_details0);
        EventBus.getDefault().register(this);
      //  MyApplication.getInstance().addDestoryActivity(this, "install0");
        initTitle();
        initJsonData();
        initView();
        upLoad();
        //initView();
    }

    private String province1;
    private String city1;
    private String district1;
    private ArrayList<Details0Bean.InfoEntity.ListEntity> list1 = new ArrayList<>();

    private void ShowPickerView() {// 弹出选择器

        OptionsPickerView pvOptions = new OptionsPickerView.Builder(this, new OptionsPickerView.OnOptionsSelectListener() {
            @Override
            public void onOptionsSelect(int options1, int options2, int options3, View v) {
                //返回的分别是三个级别的选中位置
                String tx = options1Items.get(options1).getPickerViewText() + "-" +
                        options2Items.get(options1).get(options2) + "-" +
                        options3Items.get(options1).get(options2).get(options3);
                your_address.setText(tx);
                province1 = options2Items.get(options1).get(options2);
                city1 = options1Items.get(options1).getPickerViewText();
                district1 = options3Items.get(options1).get(options2).get(options3);

            }
        })

                .setTitleBgColor(Color.WHITE)//标题背景颜色 Night mode
                .setTitleColor(getResources().getColor(R.color.text))//标题文字颜色)//标题文字颜色
                .setSubmitColor(getResources().getColor(R.color.main_color))//确定按钮文字颜色
                .setCancelColor(getResources().getColor(R.color.main_color))//取消按钮文字颜色.build();
                .build();
        /*pvOptions.setPicker(options1Items);//一级选择器
        pvOptions.setPicker(options1Items, options2Items);//二级选择器*/
        if (options1Items.size() == 0) {
            initJsonData();
            return;
        }
        pvOptions.setPicker(options1Items, options2Items, options3Items);//三级选择器
        pvOptions.show();
    }

    private ArrayList<JsonBean> options1Items = new ArrayList<>();
    private ArrayList<ArrayList<String>> options2Items = new ArrayList<>();
    private ArrayList<ArrayList<ArrayList<String>>> options3Items = new ArrayList<>();

    private void initJsonData() {//解析数据

        /**
         * 注意：assets 目录下的Json文件仅供参考，实际使用可自行替换文件
         * 关键逻辑在于循环体
         *
         * */
        String JsonData = new GetJsonDataUtil().getJson(this, "province.json");//获取assets目录下的json文件数据

        ArrayList<JsonBean> jsonBean = GetJsonDataUtil.parseData(JsonData);//用Gson 转成实体

        /**
         * 添加省份数据
         *
         * 注意：如果是添加的JavaBean实体，则实体类需要实现 IPickerViewData 接口，
         * PickerView会通过getPickerViewText方法获取字符串显示出来。
         */
        options1Items = jsonBean;

        for (int i = 0; i < jsonBean.size(); i++) {//遍历省份
            ArrayList<String> CityList = new ArrayList<>();//该省的城市列表（第二级）
            ArrayList<ArrayList<String>> Province_AreaList = new ArrayList<>();//该省的所有地区列表（第三极）

            for (int c = 0; c < jsonBean.get(i).getCityList().size(); c++) {//遍历该省份的所有城市
                String CityName = jsonBean.get(i).getCityList().get(c).getName();
                CityList.add(CityName);//添加城市

                ArrayList<String> City_AreaList = new ArrayList<>();//该城市的所有地区列表

                //如果无地区数据，建议添加空字符串，防止数据为null 导致三个选项长度不匹配造成崩溃
                if (jsonBean.get(i).getCityList().get(c).getArea() == null
                        || jsonBean.get(i).getCityList().get(c).getArea().size() == 0) {
                    City_AreaList.add("");
                } else {

                    for (int d = 0; d < jsonBean.get(i).getCityList().get(c).getArea().size(); d++) {//该城市对应地区所有数据
                        String AreaName = jsonBean.get(i).getCityList().get(c).getArea().get(d);

                        City_AreaList.add(AreaName);//添加该城市所有地区数据
                    }
                }
                Province_AreaList.add(City_AreaList);//添加该省所有地区数据
            }

            /**
             * 添加城市数据
             */
            options2Items.add(CityList);

            /**
             * 添加地区数据
             */
            options3Items.add(Province_AreaList);
        }
    }


    //
    private String pid = "";
    private String name = "";

    private void initTitle() {
        pid = getIntent().getStringExtra("pid");
        name = getIntent().getStringExtra("name");
        TextView title = (TextView) findViewById(R.id.view_main_middle_title);
        title.setText("" + name);
        findViewById(R.id.btn_main_left).setOnClickListener(this);
        ImageView ic_telephone = (ImageView) findViewById(R.id.ic_telephone);
        ic_telephone.setOnClickListener(this);
        ic_telephone.setVisibility(View.GONE);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_main_left:
                finish();
                break;
            case R.id.select_project:
                startActivityForResult(new Intent(this, SelectProject2Activity.class).putExtra("pid", pid), 999);
                break;
            case R.id.look2:
            case R.id.look:
                startActivity(new Intent(this, LookComActivity.class).putExtra("pid", pid).putExtra("type", "0"));
                break;
            case R.id.address:
                ShowPickerView();
                break;
            case R.id.btn:
                if (MyApplication.getInstance().getUserBean() == null) {
                    MyToast("请登录");
                    startActivity(new Intent(getApplicationContext(), LoginFirstActivity.class));
                    return;
                }
                Intent intent = new Intent(this, InstallYuYueActivity.class);
                if (!"1".equals(pid)) {
                    if ("".equals(selectId)) {
                        MyToast("请选择套餐");
                        return;
                    } else {
                        intent.putExtra("selectId", selectId);
                    }
                }
                intent.putExtra("your_name", your_name.getText().toString());
                intent.putExtra("your_address", your_address.getText().toString());
                intent.putExtra("your_phone", your_phone.getText().toString());
                intent.putExtra("your_area", your_area.getText().toString());
                intent.putExtra("type", "0");
                intent.putExtra("pid", pid);


                DecimalFormat df = new DecimalFormat("######0.00");
                if (!"".equals(your_area.getText().toString())) {
                    try {
                        intent.putExtra("price", "" + df.format(Double.parseDouble(bean.getInfo().getPrice()) * Double.parseDouble(area.getText().toString())));
                    } catch (Exception e) {
                        intent.putExtra("price", "" + df.format(Double.parseDouble(bean.getInfo().getPrice()) * 1));
                    }
                } else {
                    intent.putExtra("price", "" + df.format(Double.parseDouble(bean.getInfo().getPrice()) * 1));
                }
                startActivity(intent);
                break;
        }
    }

    private String selectId = "";

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        switch (requestCode) {
            case 999:
                if (resultCode == RESULT_OK) {
                    selectId = data.getStringExtra("selectId");
                    project_name.setText("" + data.getStringExtra("selectName"));
                }
                break;
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

    private Details0Bean2 bean = new Details0Bean2();

    private void upLoad() {
        Map<String, Object> map = new HashMap<>();
        map.put("pid", pid);
        map.put("type", "0");
        showDialog();
        XUtil.Post(Url.DECORATE_DETAIL, map, new MyCallBack<String>() {
            @Override
            public void onSuccess(String result) {
                super.onSuccess(result);
                Log.i("----", "onSuccess:= " + result);
                try {
                    JSONObject jsonObject = new JSONObject(result);
                    String res = jsonObject.optString("result");
                    if ("1".equals(res)) {
                        Gson gson = new Gson();
                        bean = gson.fromJson(result, Details0Bean2.class);
                        Details0Bean2.InfoEntity info = bean.getInfo();
                        setData(info);
                    } else {
                        String info = jsonObject.optString("info");
                        if ("-1".equals(res)) {
                            info = "请重新登录";
                        }
                        MyToast(info);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onFinished() {
                closeDialog();
                super.onFinished();
            }

            @Override
            public void onError(Throwable ex, boolean isOnCallback) {
                super.onError(ex, isOnCallback);
                closeDialog();
                ex.printStackTrace();
            }
        });
    }


//----
//
//    private RecyclerView recycler;
//
//    private void initView() {
//        youxiu = (RecyclerView) findViewById(R.id.youxiu);
//        youxiu.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
//        recycler = (RecyclerView) findViewById(R.id.recycler);
//        recycler.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
//        cailiao = (LinearLayout) findViewById(R.id.cailiao);
//        zhuangxiu = (LinearLayout) findViewById(R.id.zhuangxiu);
//        zhuangxiuxian = findViewById(R.id.zhuangxiuxian);
//        if (!"1".equals(pid)) {
//            cailiao.setVisibility(View.VISIBLE);
//        }
//        if ("3".equals(pid)) {
//            zhuangxiu.setVisibility(View.VISIBLE);
//            zhuangxiuxian.setVisibility(View.VISIBLE);
//        }
//        names = (TextView) findViewById(R.id.name2);
//        price = (TextView) findViewById(R.id.price);
//        desc = (TextView) findViewById(R.id.desc);
//    }
//
//    private Details0Bean.InfoEntity info = new Details0Bean.InfoEntity();
//
//
//
//    private Banner banner;
//    private TextView names, price, desc;
//    private BaseRVAdapter adapter;
//
//    private void initData() {
//        findViewById(R.id.btn).setOnClickListener(this);
//        banner = (Banner) findViewById(R.id.banner);
//        banner.setImageLoader(new GlideImageLoader());
//        banner.setImages(info.getIndex_pic());
//        //banner设置方法全部调用完毕时最后调用
//        banner.start();
//        names.setText(info.getName() + "");
//        price.setText("￥" + info.getPrice() + "/" + info.getUnit());
//        desc.setText(info.getDes() + "");
//        adapter = new BaseRVAdapter(this, info.getList()) {
//            @Override
//            public int getLayoutId(int viewType) {
//                return R.layout.item_install_detail;
//            }
//
//            @Override
//            public void onBind(BaseViewHolder holder, final int position) {
//                holder.setTextView(R.id.name, info.getList().get(position).getCatename());
//                holder.getTextView(R.id.name).setOnClickListener(new View.OnClickListener() {
//                    @Override
//                    public void onClick(View v) {
//                        String i = "";
//                        try {
//                            i = info.getList().get(position).getInfo1().get(0).getPid();
//                        } catch (Exception e) {
//                            i = "";
//
//                        }
//                        upLaod(info.getList().get(position).getCateid(), position, info.getList().get(position).getCatename(), i);
//                    }
//                });
//                RecyclerView recycler = holder.getView(R.id.recycler);
//                recycler.setLayoutManager(new LinearLayoutManager(InstallDetails0Activity.this, LinearLayoutManager.VERTICAL, false));
//                recycler.setAdapter(new BaseRVAdapter(InstallDetails0Activity.this, info.getList().get(position).getInfo1()) {
//                    @Override
//                    public int getLayoutId(int viewType) {
//                        return R.layout.item_install_detail2;
//                    }
//
//                    @Override
//                    public void onBind(BaseViewHolder holder, int position2) {
//                        x.image().bind(holder.getImageView(R.id.img), info.getList().get(position).getInfo1().get(position2).getLogo_pic());
//                        holder.setTextView(R.id.text, info.getList().get(position).getInfo1().get(position2).getGoods_name());
//                    }
//                });
//            }
//
//        };
//        recycler.setAdapter(adapter);
//
//        youxiu.setAdapter(new BaseRVAdapter(this, info.getExample()) {
//            @Override
//            public int getLayoutId(int viewType) {
//                return R.layout.item_youxiu;
//            }
//
//            @Override
//            public void onBind(BaseViewHolder holder, int position) {
//                x.image().bind(holder.getImageView(R.id.head), info.getExample().get(position).getHead_img());
//                // x.image().bind(holder.getImageView(R.id.bg12312), info.getExample().get(position).getImg());
//                //holder.getImageView(R.id.bg12312).setScaleType(ImageView.ScaleType.CENTER_CROP);
//                //  Picasso.with(InstallDetails0Activity.this).load(info.getExample().get(position).getImg() + "").into(holder.getImageView(R.id.bg12312));
//                holder.setTextView(R.id.name, "业主：" + info.getExample().get(position).getName());
//                holder.setTextView(R.id.address, info.getExample().get(position).getAddress() + "\t\t" + info.getExample().get(position).getArea());
//                ImageLoadUrl.downloadImgByUrl(info.getExample().get(position).getImg(), 100 * 100, holder.getImageView(R.id.bg12312));
//            }
//
//        });
//    }
//
//    private void upLaod(String cateid, final int pos, final String name, final String rid) {
//        Map<String, Object> map = new HashMap<>();
//        map.put("cateid", cateid);
//        showDialog();
//        XUtil.Post(Url.DECORATE_GOODSLIST, map, new MyCallBack<String>() {
//            @Override
//            public void onSuccess(String result) {
//                super.onSuccess(result);
//                Log.i("----", "onSuccess:= " + result);
//                try {
//                    JSONObject jsonObject = new JSONObject(result);
//                    String res = jsonObject.optString("result");
//                    if ("1".equals(res)) {
//                        Gson gson = new Gson();
//                        InstaItemBean bean = gson.fromJson(result, InstaItemBean.class);
//                        List<InstaItemBean.InfoEntity> info = bean.getInfo();
//                        ArrayList<InstaItemBean.InfoEntity> info1 = (ArrayList<InstaItemBean.InfoEntity>) info;
//                        startActivityForResult(new Intent(InstallDetails0Activity.this, SelectInstallActivity.class).putExtra("position", pos).putExtra("info", info1).putExtra("name", name).putExtra("rid", "" + rid), 999);
//                    } else {
//                        String info = jsonObject.optString("info");
//                        if ("-1".equals(res)) {
//                            info = "请重新登录";
//                        }
//                        MyToast(info);
//                    }
//                } catch (JSONException e) {
//                    e.printStackTrace();
//                }
//            }
//
//            @Override
//            public void onFinished() {
//                closeDialog();
//                super.onFinished();
//            }
//
//            @Override
//            public void onError(Throwable ex, boolean isOnCallback) {
//                super.onError(ex, isOnCallback);
//                closeDialog();
//                ex.printStackTrace();
//            }
//        });
//    }
//
//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//        if (requestCode == 999 && resultCode == RESULT_OK) {
//            int i = data.getIntExtra("position", 0);
//            InstaItemBean.InfoEntity bean = (InstaItemBean.InfoEntity) data.getSerializableExtra("bean");
//            List<Details0Bean.InfoEntity.ListEntity.Info1Entity> info1 = new ArrayList<>();
//            Details0Bean.InfoEntity.ListEntity.Info1Entity in = new Details0Bean.InfoEntity.ListEntity.Info1Entity();
//            in.setDesc(bean.getDesc());
//            in.setGoods_name(bean.getGoods_name());
//            in.setLogo_pic(bean.getLogo_pic());
//            in.setPid(bean.getPid());
//            in.setPrice(bean.getPrice());
//            in.setUnit(bean.getUnit());
//            in.setType(bean.getType());
//            info1.add(in);
//            info.getList().get(i).setInfo1(info1);
//            adapter.notifyDataSetChanged();
//
//        }
//        super.onActivityResult(requestCode, resultCode, data);
//    }

//
//    @Override
//    public void onClick(View v) {
//        switch (v.getId()) {
//            case R.id.btn_main_left:
//                finish();
//                break;
//            case R.id.ic_telephone:
//
//                break;
//            case R.id.btn:
//                if (MyApplication.getInstance().getUserBean() == null) {
//                    MyToast("请登录");
//                    startActivity(new Intent(getApplicationContext(), LoginFirstActivity.class));
//                    return;
//                }
//
//
//                if (!"1".equals(pid)) {
//                    List<Details0Bean.InfoEntity.ListEntity> list = info.getList();
//                    if (list == null) {
//                        startActivity(new Intent(this, InstallYuYueActivity.class).putExtra("type", "0").putExtra("pid", pid).putExtra("price", info.getPrice()));
//                        return;
//                    }
//                    ArrayList<Details0Bean.InfoEntity.ListEntity> list1 = new ArrayList<>();
//                    int j = 0;
//                    for (int i = 0; i < list.size(); i++) {
//                        try {
//                            if ("".equals(list.get(i).getInfo1().get(0).getPid())) {
//                                j++;
//                            } else {
//                                list1.add(list.get(i));
//                            }
//                        } catch (Exception e) {
//                            j++;
//                        }
//                    }
//                    if (j == list.size()) {
//                        MyToast("请至少选择一个材料");
//                        return;
//                    }
//                    startActivity(new Intent(this, InstallYuYueActivity.class).putExtra("type", "0").putExtra("pid", pid).putExtra("list", list1).putExtra("price", info.getPrice()));
//                } else {
//                    startActivity(new Intent(this, InstallYuYueActivity.class).putExtra("type", "0").putExtra("pid", pid).putExtra("price", info.getPrice()));
//                }
//                break;
//        }
//    }

}
